#ifndef __AUDIO_DECODER_H__
#define __AUDIO_DECODER_H__
#include "stdint.h"
#include "y_ringbuf.h"


extern uint8_t Audio_Decode_TaskID;


// ETH Task Events
#define AUDIO_DECODE_EVENT         		 1<<1
// ETH Task Events
#define AUDIO_START_DECODE_EVENT         1<<2
// ETH Task Events
#define AUDIO_STOP_DECODE_EVENT          1<<3



#define ENCODER_EVENT (0)

typedef enum
{
	DECODER_STATE_IDLE,
    DECODER_STATE_BUSY,
    DECODER_STATE_MAX,
}Current_Decoder_Status_t;

typedef struct
{
	uint8_t code;
	Current_Decoder_Status_t status;
	RINGBUF_st *adpcm_in_ringbuffer;
	RINGBUF_st *decoder_out_ringbuffer;

}Audio_Decode_t;	


#define AUDIO_DECODE_FRAME_LEN    64
#define RINGBUFFER_DECODE_LEN	  1024*2


void audio_decoder_init(void);

void audio_decoder_start(void);

void audio_decoder_stop(void);

bool get_audio_decoder_is_busy(void);
bool get_num_audio_decoder_is_busy(uint8_t num);


void audio_reset_decoder_ringbuffer();
bool audio_decoder_src_input(uint8_t*data,uint16_t len);
uint16_t get_audio_decoder_valid_size();

bool audio_decoder_dst_output(uint8_t*data,uint16_t len);
uint16_t get_audio_decoder_output_valid_size();

void Audio_Decode_Send_Msg(uint8_t type,uint8_t code,uint8_t len);

void Audio_Decode_Send_Event();

void msg_post_decode_handler();

#endif
